package com.tiancikeji.zaoke.app.service.bill.impl.alipay;

import java.io.IOException;
import java.util.Date;

import com.tiancikeji.zaoke.app.model.order.Bill;
import com.tiancikeji.zaoke.app.service.bill.impl.alipay.util.Md5Trade;

public class AlipayWapPayMent implements PayMent {

    private Md5Trade md5Trade;

    public String getPayUrl(Bill bill, String system) {
        try {
            return md5Trade.getPayUrl(bill, system);
        }
        catch (IOException e) {
            return null;
        }
    }

	public Md5Trade getMd5Trade() {
		return md5Trade;
	}

	public void setMd5Trade(Md5Trade md5Trade) {
		this.md5Trade = md5Trade;
	}

	public static void main(String[] args) throws IOException {
		System.out.println("start");
		AlipayWapPayMent m = new AlipayWapPayMent();
		Md5Trade t = new Md5Trade();
		t.setAlipayWapConfig(new AlipayWapConfig());
		m.setMd5Trade(t);
		Bill bill = new Bill();
		bill.setBackUrl("uirl");
		bill.setBody("body");
		bill.setCode("code");
		bill.setId(1l);
		bill.setMoney(23.81);
		bill.setOutSerialId("" + System.currentTimeMillis());
		bill.setPaymode(1);
		bill.setReturnUrl("return url");
		bill.setSerialId("" + System.currentTimeMillis());
		bill.setStatus(0);
		bill.setSubject("subject");
		bill.setTime(new Date());
		bill.setTrace("trace");
		bill.setUpdateTime(new Date());
		bill.setUserId(1l);
		System.out.println(m.getPayUrl(bill, ""));
		System.out.println("end....");
	}
}
